- Notifications
You must be signed in to change notification settings - Fork 1.6k
/
Copy pathsource.cpp
46 lines (41 loc) · 1.46 KB
/
source.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#using <System.Xml.dll>
#using <System.Drawing.dll>
#using <System.dll>
#using <System.Windows.Forms.dll>
#using <System.Data.dll>
usingnamespaceSystem;
usingnamespaceSystem::Data;
usingnamespaceSystem::Windows::Forms;
public ref classForm1: publicForm
{
protected:
TextBox^ textBox1;
DataSet^ ds;
// <Snippet1>
protected:
voidBindControls()
{
/* Create a new Binding using the DataSet and a
navigation path(TableName.RelationName.ColumnName).
Add event delegates for the Parse and Format events to
the Binding object, and add the object to the third
TextBox control's BindingsCollection. The delegates
must be added before adding the Binding to the
collection; otherwise, no formatting occurs until
the Current object of the BindingManagerBase for
the data source changes. */
Binding^ b = gcnew Binding(
"Text",ds,"customers.custToOrders.OrderAmount" );
b->Parse += gcnew ConvertEventHandler(
this, &Form1::CurrencyStringToDecimal );
b->Format += gcnew ConvertEventHandler(
this, &Form1::DecimalToCurrencyString );
textBox1->DataBindings->Add( b );
}
// </Snippet1>
private:
// method added so sample will compile
voidCurrencyStringToDecimal( Object^ /*sender*/, ConvertEventArgs^ /*e*/ ){}
// method added so sample will compile
voidDecimalToCurrencyString( Object^ /*sender*/, ConvertEventArgs^ /*e*/ ){}
};